<template>
	<slot :controller="controller" :store="store" :model="model">
    <AppForm
		ref="editForm"
        v-bind="$attrs"
		:id="controlID"
		:name="model.codeName"
		:class="classNames"
		:data="store.data"
		>
        <AppAnchor v-if="store.anchorData.length > 0" :controlID="controlID" :anchorData="store.anchorData" />
        <div class="control-content app-control-form__content">
			<AppRow :layoutOpts="{selfLayout: 'TABLE_24COL',}">
				<AppCol
				    noRoot
				    :visible="store.detailModel.group1.visible"
				    :layoutOpts="{selfLayout: 'TABLE_24COL',parentLayout: 'TABLE_24COL',colMD: 12,colSM: 12,colXS: 12,}">
				    <template #default="{ slotClass, slotStyle }">
				        <slot name="group1" :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				            <AppFormGroup 
				                name="group1"
				                v-show="store.detailModel.group1.visible"
				                :slotClass="slotClass"
				                :slotStyle="slotStyle"
				                :layoutOpts="{selfLayout: 'TABLE_24COL',parentLayout: 'TABLE_24COL',colMD: 12,colSM: 12,colXS: 12,}"
				                :title="$t('CONTROL.DEFORM.IBIZORDER.MAIN.GROUPPANEL.GROUP1', '订单基本信息')"
				                subCaption=""
				                :enableAnchor="false"
				                :showMoreItems="store.detailModel.group1.showMoreItems"
				                :showMoreMode="store.detailModel.group1.showMoreMode"
				                :infoGroupMode="false"
				                :titleBarCloseMode="0"
				                :showCaption="true"
				                :uIActionGroup="store.detailModel.group1.uIActionGroup"
				                @component-action="(actionParam: any) => { handleComponentAction(controller, actionParam) }">
				                <AppCol
				                    noRoot
				                    :visible="store.detailModel.orderuid.visible"
				                    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 6,colSM: 6,colXS: 6,}">
				                    <template v-slot:default="{ slotStyle, slotClass }">
				                        <slot name="orderuid"  :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				                            <AppFormItem 
				                                name="orderuid"
				                                :slotStyle="slotStyle"
				                                :slotClass="slotClass" 
				                                :label="$t('DEF.LNAME.ORDERUID', '订单编号')"
				                                labelPos="LEFT" 
				                                :labelWidth="130" 
				                                :showLabel="true"
				                                :enableAnchor="false" 
				                                :rules="store.detailModel.orderuid.valueRule"
				                                :emptyCaption="false">
				                                <div class="form-editor-container">
				                                    <slot name="orderuidEditor"  :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                                        <AppColorSpan
				                                            v-bind="{ editorType: 'SPAN', editorStyle: 'COLORSPAN', color: 'formitem' }"
				                                            color="formitem"
				                                            style=""
				                                            name="orderuid"
				                                            :data="store.data"
				                                            :value="store.data.orderuid"
				                                        />
				                                    </slot>
				                                </div>
				                            </AppFormItem>
				                        </slot>
				                    </template>
				                </AppCol>
				                <AppCol
				                    noRoot
				                    :visible="store.detailModel.formitem.visible"
				                    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 6,colSM: 6,colXS: 6,}">
				                    <template v-slot:default="{ slotStyle, slotClass }">
				                        <slot name="formitem"  :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				                            <AppFormItem 
				                                name="formitem"
				                                :slotStyle="slotStyle"
				                                :slotClass="slotClass" 
				                                :label="$t('DEF.LNAME.ORDERUID', '订单编号')"
				                                labelPos="LEFT" 
				                                :labelWidth="130" 
				                                :showLabel="true"
				                                :enableAnchor="false" 
				                                :rules="store.detailModel.formitem.valueRule"
				                                :emptyCaption="false">
				                                <div class="form-editor-container">
				                                    <slot name="formitemEditor"  :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                                        <AppInput
				                                            v-bind="{ editorType: 'TEXTBOX', }"
				                                            type="text"
				                                            style=""
				                                            name="formitem"
				                                            :isDebounce="false"
				                                            :disabled="store.detailModel.formitem.disabled"
				                                            :value="store.data.formitem"
				                                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
				                                        />
				                                    </slot>
				                                </div>
				                            </AppFormItem>
				                        </slot>
				                    </template>
				                </AppCol>
				                <AppCol
				                    noRoot
				                    :visible="store.detailModel.ordername.visible"
				                    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 6,colSM: 6,colXS: 6,}">
				                    <template v-slot:default="{ slotStyle, slotClass }">
				                        <slot name="ordername"  :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				                            <AppFormItem 
				                                name="ordername"
				                                :slotStyle="slotStyle"
				                                :slotClass="slotClass" 
				                                :label="$t('DEF.LNAME.IBIZORDERID', '订单名称')"
				                                labelPos="LEFT" 
				                                :labelWidth="130" 
				                                :showLabel="true"
				                                :enableAnchor="false" 
				                                :rules="store.detailModel.ordername.valueRule"
				                                :emptyCaption="false">
				                                <div class="form-editor-container">
				                                    <slot name="ordernameEditor"  :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                                        <AppSpan
				                                            :context="store.context"
				                                            :viewParams="store.viewParams"
				                                            :dataType="25"
				                                            v-bind="{ editorType: 'SPAN', editorStyle: 'ADDRESSPICKUP', VALUETYPE: 'SIMPLES', text: '长沙' }"
				                                            deMajorField=""
				                                            editorType="ADDRESSPICKUP"
				                                            style=""
				                                            name="ordername"
				                                            noValueShowMode="STYLE1"
				                                            :value="store.data.ordername"
				                                        />
				                                    </slot>
				                                </div>
				                            </AppFormItem>
				                        </slot>
				                    </template>
				                </AppCol>
				                <AppCol
				                    noRoot
				                    :visible="store.detailModel.ordertime.visible"
				                    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 6,colSM: 6,colXS: 6,}">
				                    <template v-slot:default="{ slotStyle, slotClass }">
				                        <slot name="ordertime"  :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				                            <AppFormItem 
				                                name="ordertime"
				                                :slotStyle="slotStyle"
				                                :slotClass="slotClass" 
				                                :label="$t('DEF.LNAME.ORDERTIME', '订单时间')"
				                                labelPos="LEFT" 
				                                :labelWidth="130" 
				                                :showLabel="true"
				                                :enableAnchor="false" 
				                                :rules="store.detailModel.ordertime.valueRule"
				                                :emptyCaption="false">
				                                <div class="form-editor-container">
				                                    <slot name="ordertimeEditor"  :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                                        <AppSpanAfterTime
				                                            v-bind="{ editorType: 'SPAN', editorStyle: 'AFTERTIME', curvalue: 500 }"
				                                            :value="store.data.ordertime"
				                                        />
				                                    </slot>
				                                </div>
				                            </AppFormItem>
				                        </slot>
				                    </template>
				                </AppCol>
				                <AppCol
				                    noRoot
				                    :visible="store.detailModel.ibizcustomername.visible"
				                    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 6,colSM: 6,colXS: 6,}">
				                    <template v-slot:default="{ slotStyle, slotClass }">
				                        <slot name="ibizcustomername"  :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				                            <AppFormItem 
				                                name="ibizcustomername"
				                                :slotStyle="slotStyle"
				                                :slotClass="slotClass" 
				                                :label="$t('DEF.LNAME.IBIZORDER.IBIZCUSTOMERNAME', '客户名称')"
				                                labelPos="LEFT" 
				                                :labelWidth="130" 
				                                :showLabel="true"
				                                :enableAnchor="false" 
				                                :rules="store.detailModel.ibizcustomername.valueRule"
				                                :emptyCaption="false">
				                                <div class="form-editor-container">
				                                    <slot name="ibizcustomernameEditor"  :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                                        <AppDataPicker
				                                            valueItem="ibizcustomerid"
				                                            :context="store.context"
				                                            :viewParams="store.viewParams"
				                                            deMajorField="ibizcustomername"
				                                            deKeyField="ibizcustomerid"
				                                            pickUpView="IBIZCustomerPickupView"
				                                            deCodeName="IBIZCUSTOMER"
				                                            :acParams="{ serviceName: 'IBIZCustomer', interfaceName: 'FetchDefault' }"
				                                            v-bind="{ editorType: 'PICKER', AC: 'TRUE', PICKUPVIEW: 'TRUE' }"
				                                            style=""
				                                            name="ibizcustomername"
				                                            :disabled="store.detailModel.ibizcustomername.disabled"
				                                            :data="store.data"
				                                            :value="store.data.ibizcustomername"
				                                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
				                                        />
				                                    </slot>
				                                </div>
				                            </AppFormItem>
				                        </slot>
				                    </template>
				                </AppCol>
				                <AppCol
				                    noRoot
				                    :visible="store.detailModel.ordertype.visible"
				                    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 6,colSM: 6,colXS: 6,}">
				                    <template v-slot:default="{ slotStyle, slotClass }">
				                        <slot name="ordertype"  :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				                            <AppFormItem 
				                                name="ordertype"
				                                :slotStyle="slotStyle"
				                                :slotClass="slotClass" 
				                                :label="$t('DEF.LNAME.ORDERTYPE', '订单类型')"
				                                labelPos="LEFT" 
				                                :labelWidth="130" 
				                                :showLabel="true"
				                                :enableAnchor="false" 
				                                :rules="store.detailModel.ordertype.valueRule"
				                                :emptyCaption="false">
				                                <div class="form-editor-container">
				                                    <slot name="ordertypeEditor"  :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                                        <AppDropdownList
				                                            codeListTag="common__DYNAORDERTYPE"
				                                            codeListType="DYNAMIC"
				                                            v-bind="{ editorType: 'DROPDOWNLIST', }"
				                                            :multiple="false"
				                                            :context="store.context"
				                                            :viewParams="store.viewParams"
				                                            style=""
				                                            name="ordertype"
				                                            :disabled="store.detailModel.ordertype.disabled"
				                                            :value="store.data.ordertype"
				                                            :data="store.data"
				                                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
				                                        /> 
				                                    </slot>
				                                </div>
				                            </AppFormItem>
				                        </slot>
				                    </template>
				                </AppCol>
				                <AppCol
				                    noRoot
				                    :visible="store.detailModel.detailnum.visible"
				                    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 6,colSM: 6,colXS: 6,}">
				                    <template v-slot:default="{ slotStyle, slotClass }">
				                        <slot name="detailnum"  :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				                            <AppFormItem 
				                                name="detailnum"
				                                :slotStyle="slotStyle"
				                                :slotClass="slotClass" 
				                                :label="$t('CONTROL.DEFORM.IBIZORDER.DATA_0024.FORMITEM.DETAILNUM', '明细数（计数）')"
				                                labelPos="LEFT" 
				                                :labelWidth="130" 
				                                :showLabel="true"
				                                :enableAnchor="false" 
				                                :rules="store.detailModel.detailnum.valueRule"
				                                :emptyCaption="false">
				                                <div class="form-editor-container">
				                                    <slot name="detailnumEditor"  :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                                        <AppSpan
				                                            :context="store.context"
				                                            :viewParams="store.viewParams"
				                                            :dataType="9"
				                                            v-bind="{ editorType: 'SPAN', }"
				                                            deMajorField=""
				                                            editorType="SPAN"
				                                            style=""
				                                            name="detailnum"
				                                            noValueShowMode="STYLE1"
				                                            :value="store.data.detailnum"
				                                        />
				                                    </slot>
				                                </div>
				                            </AppFormItem>
				                        </slot>
				                    </template>
				                </AppCol>
				                <AppCol
				                    noRoot
				                    :visible="store.detailModel.orderstate.visible"
				                    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 6,colSM: 6,colXS: 6,}">
				                    <template v-slot:default="{ slotStyle, slotClass }">
				                        <slot name="orderstate"  :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				                            <AppFormItem 
				                                name="orderstate"
				                                :slotStyle="slotStyle"
				                                :slotClass="slotClass" 
				                                :label="$t('DEF.LNAME.ORDERSTATE', '订单状态')"
				                                labelPos="LEFT" 
				                                :labelWidth="130" 
				                                :showLabel="true"
				                                :enableAnchor="false" 
				                                :rules="store.detailModel.orderstate.valueRule"
				                                :emptyCaption="false">
				                                <div class="form-editor-container">
				                                    <slot name="orderstateEditor"  :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                                        <AppDropdownList
				                                            codeListTag="common__ORDERSTATE"
				                                            codeListType="STATIC"
				                                            v-bind="{ editorType: 'DROPDOWNLIST', }"
				                                            :multiple="false"
				                                            :context="store.context"
				                                            :viewParams="store.viewParams"
				                                            style=""
				                                            name="orderstate"
				                                            :disabled="store.detailModel.orderstate.disabled"
				                                            :value="store.data.orderstate"
				                                            :data="store.data"
				                                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
				                                        /> 
				                                    </slot>
				                                </div>
				                            </AppFormItem>
				                        </slot>
				                    </template>
				                </AppCol>
				                <AppCol
				                    noRoot
				                    :visible="store.detailModel.memo.visible"
				                    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 12,colSM: 12,colXS: 12,}">
				                    <template v-slot:default="{ slotStyle, slotClass }">
				                        <slot name="memo"  :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				                            <AppFormItem 
				                                name="memo"
				                                :slotStyle="slotStyle"
				                                :slotClass="slotClass" 
				                                :label="$t('DEF.LNAME.MEMO', '备注')"
				                                labelPos="LEFT" 
				                                :labelWidth="130" 
				                                :showLabel="true"
				                                :enableAnchor="false" 
				                                :rules="store.detailModel.memo.valueRule"
				                                :emptyCaption="false">
				                                <div class="form-editor-container">
				                                    <slot name="memoEditor"  :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                                        <AppInput
				                                            v-bind="{ editorType: 'TEXTAREA_10', HEIGHT: 200 }"
				                                            :isTextArea10="true"
				                                            type="textarea"
				                                            style="height: 100px"
				                                            name="memo"
				                                            :isDebounce="false"
				                                            :disabled="store.detailModel.memo.disabled"
				                                            :value="store.data.memo"
				                                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
				                                        />
				                                    </slot>
				                                </div>
				                            </AppFormItem>
				                        </slot>
				                    </template>
				                </AppCol>
				            </AppFormGroup>
				        </slot>
				    </template>
				</AppCol>
				<AppCol
				    noRoot
				    :visible="store.detailModel.grouppanel1.visible"
				    :layoutOpts="{selfLayout: 'TABLE_24COL',parentLayout: 'TABLE_24COL',colMD: 24,}">
				    <template #default="{ slotClass, slotStyle }">
				        <slot name="grouppanel1" :controller="controller" :store="store" :model="model" :slotClass="slotClass" :slotStyle="slotStyle" :actions="{ handleComponentAction }">
				            <AppFormGroup 
				                name="grouppanel1"
				                v-show="store.detailModel.grouppanel1.visible"
				                :slotClass="slotClass"
				                :slotStyle="slotStyle"
				                :layoutOpts="{selfLayout: 'TABLE_24COL',parentLayout: 'TABLE_24COL',colMD: 24,}"
				                :title="$t('CONTROL.DEFORM.IBIZORDER.DATA_0024.GROUPPANEL.GROUPPANEL1', '订单明细')"
				                subCaption=""
				                :enableAnchor="false"
				                :showMoreItems="store.detailModel.grouppanel1.showMoreItems"
				                :showMoreMode="store.detailModel.grouppanel1.showMoreMode"
				                :infoGroupMode="false"
				                :titleBarCloseMode="0"
				                :showCaption="true"
				                :uIActionGroup="store.detailModel.grouppanel1.uIActionGroup"
				                @component-action="(actionParam: any) => { handleComponentAction(controller, actionParam) }">
				                <AppCol
				                    noRoot
				                    :visible="store.detailModel.druipart1.visible"
				                    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 24,}">
				                    <slot name="druipart1" :controller="controller" :store="store" :model="model" :actions="{ handleComponentAction }">
				                        <AppFormDruipart 
				                            name="druipart1"
				                            :paramItem="model.entityCodeName.toLowerCase()"
				                            :parentName="model.entityCodeName"
				                            :context="store.context"
				                            :viewParams="store.viewParams"
				                            :data="store.data"
				                            :isLoaded ="store.isLoaded"
				                            :tempMode="0"
				                            viewName="IBIZOrderDetailGridView"
				                            @component-action="(actionParam: any) => { handleComponentAction(controller, actionParam) }">
				                        </AppFormDruipart>
				                    </slot>
				                </AppCol>
				            </AppFormGroup>
				        </slot>
				    </template>
				</AppCol>
			</AppRow>
        </div>
    </AppForm>
	</slot>
</template>
<script setup lang="ts">
// 基于template/src/widgets/{{appEntities}}/{{ctrls@FORM}}-form/{{spinalCase ctrl.codeName}}-form-base.vue.hbs生成

import { Ref } from 'vue';
import { AppAnchor } from '@components/common/anchor';
import { AppCol } from '@/components/common/col';
import { AppRow } from '@/components/common/row';
import { AppForm, AppFormPage, AppFormGroup, AppFormTabPage, AppFormItem, AppFormButton, AppFormDruipart, AppFormIframe, AppFormRaw, AppFormMdCtrl, AppFormMdCtrlRepeater } from '@components/widgets/form';
import { IEvent, EditFormActionType, IEditFormAbility, IEditFormStore, IParam } from '@/core';
import { useProps, useBasic, useAction, useController } from './data-0024-form-hook';

const editForm: Ref = ref(null);

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { controlID, getClassNames, model ,useNavParamsBind, useEventBind, handleActionClick, handleComponentAction } = useBasic(props);

const emit = defineEmits<{
    (event: 'ctrl-action', name: string, action: EditFormActionType, data: IParam[]): void;
    (event: 'ctrl-init', name: string, data: IEditFormAbility): void;
    (event: 'ctrl-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
//  部件样式名
const classNames = computed(() => {
  return getClassNames(props);
});

//  表单控制器
const controller = useController(props, evt, { controlID, editForm });

useNavParamsBind(controller, props);

const store: IEditFormStore = controller.getStore();

const ctrlService = controller.getCtrlService();

onMounted(() => {
    controller.ctrlMounted();
});
onUnmounted(() => {
    controller.ctrlDestroy();
})
</script>